package com.example.product_practices.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.product_practices.domain.ReplyTb;
import com.example.product_practices.mapper.QuestionnaireMapper;
import com.example.product_practices.mapper.ReplyTbMapper;
import com.example.product_practices.service.IQuestionService;
import com.example.product_practices.service.IReplyTbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class ReplyTbServiceImpl extends ServiceImpl<ReplyTbMapper, ReplyTb> implements IReplyTbService {
    @Autowired
    IQuestionService questionService;
    @Override
    public int replyinfobyid(Integer userId, Integer questionnaireId) {
         return this.baseMapper.countmark(userId,questionnaireId);

    }
    @Override
    public Map<Integer, Integer> replyinfobath(List<Integer> userIds, Integer questionnaireId) {
        Map<Integer, Integer> map = new HashMap<>();
        for (Integer id:userIds){
            int replyinfobyid = this.baseMapper.countmark(id, questionnaireId);
            map.put(id,replyinfobyid);
        }
        return map;
    }

}
